#include<iostream>
using namespace std;

int main()
{
	int count = 0;
	
	for (int i = 1; i <= 2019; i++)
	{
		int m = i;
		while (m)
		{
			if (m % 10 ==9)
			{
				count++;
				break;
			}
			m /= 10;
		}
	} 
	cout << count << endl;
	
	return 0;
}
